package com.example.administrator.foodrowfresh.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.administrator.foodrowfresh.R;
import com.example.administrator.foodrowfresh.models.ClassifySeek;
import com.example.administrator.foodrowfresh.superBase.MyBaseAdapter;

import java.util.List;

/**
 * Created by Administrator on 2016/5/5.
 */
public class SeekGridViewAdapter extends MyBaseAdapter {

    private List<ClassifySeek.DataBean> dataBeans;
    private LayoutInflater inflater;
    public SeekGridViewAdapter(List list, Context mContext) {
        super(list, mContext);
        this.dataBeans=list;
        inflater=LayoutInflater.from(mContext);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        SeekViewHolder viewHolder=null;
        if (convertView==null)
        {
            convertView=inflater.inflate(R.layout.layout_gridview_seek_item,parent,false);
            viewHolder=new SeekViewHolder(convertView);
            convertView.setTag(viewHolder);
        }else
        {
            viewHolder= (SeekViewHolder) convertView.getTag();
        }
        viewHolder.button.setText(dataBeans.get(position).getHotWordName());
        return convertView;
    }
    public class SeekViewHolder
    {
        Button button;
        public SeekViewHolder(View convertView)
        {
            super();
            button= (Button) convertView.findViewById(R.id.btn_seek_id);
        }
    }
}
